package com.minio.miniospringboot.config;

import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author Bang
 * @ClassName: MinioConfiguration
 * @Date: 2023/03/15 17:28
 * @Version: 1.0
 * @Modified By:
 */
@Configuration
public class MinioConfiguration {


    @Resource
    private MinioProperties minioProperties;

    /**
     * 初始化 MinIO 客户端
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                .build();
    }
}
